package com.wz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @description:消费compute-service的add服务。直接通过RestTemplate来调用服务 ， 计算值。
 * @author: WZ
 * @create: 2018-07-20 15:07
 **/
@RestController
public class ConsumerController {

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(value="/add")
    public String add(@RequestParam Integer a, @RequestParam Integer b){
        return restTemplate.getForEntity("http://COMPUTE-SERVICE/add?a="+a+"&b="+b+"",String.class).getBody();
    }

}
